package com.nfc.lock.controller;

import com.nfc.lock.common.result.Result;
import com.nfc.lock.dto.response.MapRoomVO;
import com.nfc.lock.service.IPowerRoomService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Map view endpoints.
 */
@Tag(name = "Map View")
@RestController
@RequestMapping("/api/v1/map")
@RequiredArgsConstructor
public class MapController {

    private final IPowerRoomService powerRoomService;

    @Operation(summary = "List power rooms for map usage")
    @GetMapping("/rooms")
    public Result<List<MapRoomVO>> getMapRooms(
            @Parameter(description = "Region ID filter") @RequestParam(required = false) Long regionId,
            @Parameter(description = "Status filter: 0-normal 1-in-use 2-alert") @RequestParam(required = false) Integer status
    ) {
        return Result.success(powerRoomService.getMapRooms(regionId, status));
    }
}
